# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=ratbag
pkgver=0.17
pkgrel=0
pkgdesc="DBus daemon to configure input devices, mainly gaming mice"
url="https://github.com/libratbag/libratbag"
arch="all"
license="MIT"
depends="dbus"
makedepends="
	elogind-dev
	eudev-dev
	glib-dev
	json-glib-dev
	libevdev-dev
	libunistring-dev
	meson
	py3-gobject3-dev
	python3-dev
	swig
"
checkdepends="check-dev py3-gobject3 py3-evdev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools:_tools"
source="$pkgname-$pkgver.tar.gz::https://github.com/libratbag/libratbag/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/libratbag-$pkgver"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dsystemd=false \
		-Dlogind-provider=elogind \
		-Dtests="$(want_check && echo true || echo false)" \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

_tools() {
	pkgdesc="ratbag cli tools"
	depends="python3 py3-evdev py3-gobject3"

	amove usr/bin/ratbagctl
	amove usr/bin/lur-command
}

sha512sums="
80ab5c895d83e28b6b6adcd0669854944d7932ef037c8d64b923a7362399e861475e9d81c5ee2cf814f654d7796b00a81314cc177f34e13c8684d525974068c8  ratbag-0.17.tar.gz
"
